#ifndef CHATGROUP_H
#define CHATGROUP_H

#include <QWidget>
#include <QTextBrowser>
#include <QDateTime>
#include <QListWidgetItem>
#include "qnchatmessage.h"
#include "widget.h"
namespace Ui {
class ChatGroup;
}

class ChatGroup : public QWidget
{
    Q_OBJECT

public:
    explicit ChatGroup(QTcpSocket *s, QString user, QString chatW, QByteArray userimg, QPixmap usericon, QWidget *parent = nullptr);
    ~ChatGroup();
    void dealMessage(QNChatMessage *messageW, QListWidgetItem *item, QString text, QString time, QNChatMessage::User_Type type);
    void dealMessageTime(QString curMsgTime);
    void getMsg(QString whoSend, QByteArray whoSendImg, QString msg);

protected:
    void resizeEvent(QResizeEvent *event);

private slots:
    void on_btn_send_clicked();

    void on_btn_more_clicked();
signals:
    void stopRecv();
    void reStartRecv();

private:
    Ui::ChatGroup *ui;
    QTcpSocket *_socket;
    QString _username;
    QString _chatWith;
    QPixmap _usericon;
    QPixmap _chatWithIcon;
    QByteArray _userimg;
};

#endif // CHATGROUP_H
